<!doctype html>
<!--[if lt IE 7 ]> <html lang="zh-cn" class="ie6"> <![endif]-->
<!--[if IE 7 ]>    <html lang="zh-cn" class="ie7"> <![endif]-->
<!--[if IE 8 ]>    <html lang="zh-cn" class="ie8"> <![endif]-->
<!--[if IE 9 ]>    <html lang="zh-cn" class="ie9"> <![endif]-->
<!--[if !IE]><!--> <html lang="zh-cn"> <!--<![endif]-->
<!DOCTYPE html>
<html>
<head>
    <title>搜索</title>
    {% include 'system/common/header.html' %}
    <link rel="stylesheet" href="{{ url_for('static', filename='zbook/css/other/page.css') }}"/>
    <style>
        .books-main{
            width: 100%;
            margin: auto;
            display: flex;
            flex-wrap: wrap;
        }
        .book-item{
            height: fit-content;
            margin: 5px;
        }
    </style>
</head>
<body class="pear-container">
{# 查询表单 #}
<div class="layui-card">
    <div class="layui-card-body">
        <form class="layui-form" action="" lay-filter="page-query-form">
            <div class="layui-form-item">
                <div class="layui-input-inline">
                    <input type="text" name="key" placeholder="" class="layui-input">
                </div>
                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="page-query">
                    <i class="layui-icon layui-icon-search"></i>
                    查询
                </button>
            </div>
        </form>
    </div>
</div>
{# 用户表格 #}
<div class="books-main ">
    {% for item in data %}
    <div class="layui-card book-item">
        <div class="layui-card-body">
            <div class="page_title"> <a href="/reader?bid={{item['id']}}">《{{ item["name"] }} 》</a>/ {{ item["auth"] }} / {{ item["sheets"]}}</div>
        </div>
    </div>
    {% endfor %}
</div>
{% include 'system/common/footer.html' %}
<script type="text/javascript">
    layui.use(['form', 'jquery'], function () {
        let form = layui.form
        let $ = layui.jquery

        $('.page-group').click(function () {
            let group = $(this).attr('page-group')
            let field = form.val('page-query-form')
            if (group === '-1') {
                field.deptId = group
                $(this).removeClass('button-default')
                $(this).prev().removeClass('button-primary')
                $(this).prev().addClass('button-default')
                $(this).addClass('button-primary')
            } else {
                field.deptId = group
                $(this).removeClass('button-default')
                $(this).next().removeClass('button-primary')
                $(this).next().addClass('button-default')
                $(this).addClass('button-primary')
            }
            window.refresh(field)
        })

        form.on('submit(page-query)', function (data) {
            window.refresh(data.field)
            return false
        })
    })
</script>

</body>
</html>